//
//  ViewController.m
//  IOS深入传值
//
//  Created by 江湖 on 2020/6/10.
//  Copyright © 2020 江湖. All rights reserved.
//

#import "ViewController.h"
#import "ViewController1.h"
#import "ViewController4.h"

#import "UIViewController+Agent.h"
@interface ViewController ()
@property(nonatomic,assign)NSInteger type;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.type = 2;
    
}


- (IBAction)goClick:(id)sender {
    
        if (self.type == 1) {
    //        代理传值
            ViewController1 *vc = [[ViewController1 alloc] init];
//            传入代理的控制器对象
            vc.delegateVC = self;
            [self.navigationController pushViewController:vc animated:YES];
        }else if(self.type == 2){
//        代理传值
            ViewController1 *vc = [[ViewController1 alloc] init];
//            传入代理的控制器对象
            vc.delegateVC = self;
            vc.viewBlock = ^{
                    NSLog(@"block回调");
            };
            [self.navigationController pushViewController:vc animated:YES];
        }
}
- (IBAction)twoClick:(id)sender {
    ViewController4 *vc = [[ViewController4 alloc] init];
    [self.navigationController pushViewController:vc animated:YES];
}

-(void)agentFunc1{
    NSLog(@"代理回调");
}


@end
